package com.example.service;

import com.example.entity.*;
import com.example.mapper.NurseMapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class NurseService {
    @Resource
    private NurseMapper nurseMapper;


    public void add(Nurse nurse) {
        nurseMapper.add(nurse);
    }

    public void update(Nurse nurse) {
        nurseMapper.update(nurse);
    }


    public PageInfo<Nurse> findBySearch(Params params) {
        PageHelper.startPage(params.getPageNum(), params.getPageSize());


        List<Nurse> list = nurseMapper.findBySearch(params);
        return PageInfo.of(list);
    }

    public void delete(Integer id) {

        nurseMapper.deleteById(id);
    }


}
